<template>
	<view class="sop-container">
		<image @click="previewImg(index,imgs)" style="width: 750rpx;" mode="widthFix" :src="img" v-for="(img,index) in imgs" :key="index"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				 sopInfoList:[],
				 imgs:[]
			}
		},
		onLoad() {
			this.refreshData();
		},
		methods: {
			refreshData(){
				uni.showLoading({
					title:"加载中...",
					icon:"none"
				})
				this.$u.api.sop.getSopList({
					itemId:this.vuex_currentTask?.itemId ||  ''
				}).then(res=>{
					uni.hideLoading();
					this.imgs = this.sopInfoList = res?.data || []
					if(this.imgs && this.imgs.length > 0){
						this.imgs = this.imgs.map(info=>{
							return info.sopUrl || ''
						})
					}
				}).catch(err=>{
					console.log(err);
					uni.hideLoading();
				})
			},
			previewImg(index,imgs){
				console.log(index,imgs)
				uni.previewImage({
					current:index,
					urls:imgs,
					loop:true
				})
			}
		}
	}
</script>

<style lang="scss">
	.sop-container{
		
	}

</style>
